<%--
  Created by IntelliJ IDEA.
  User: 12700
  Date: 2025/9/5
  Time: 1:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>管理员中心</title>
    <link rel="stylesheet" href="../../css/alogin.css">
    <script type="text/javascript" src="../../js/jquery-1.8.3.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var username = new URLSearchParams(window.location.search).get("username");
            $("#username").empty();
            $("<input type=text value='"+username+"' disabled>").appendTo("#username");
            $("[value='提交']").click(function () {
                var password = $("#password").val();
                var role = $("#role").val();
                $.get("../../admin/updateusers",{"username":username,"password":password,"role":role},function (b) {
                    if(b){
                        alert("修改成功!");
                        window.location.href="usersadmin.jsp";
                    }else{
                        alert("修改失败!");
                        window.location.href="usersadmin.jsp";
                    };
                });
            });
        });
    </script>
</head>
<body>
<div class="label">
    <div class="box">
        <div class="box-left">
            <div><img src="../../images/rest.jpeg" alt=""></div>
        </div>
        <div class="box-right">
            <table>
                <tr>
                    <h2>修改信息</h2>
                </tr>
                <tr>
                    <p>账户:</p>
                    <div id="username">
                        <input type="text" disabled>
                    </div>
                    <p>密码:</p>
                        <input type="text" id="password">
                    <br>
                    <p>角色:</p>
                    <select id="role">
                        <option value="用户">用户</option>
                        <option value="物流员">物流员</option>
                        <option value="管理员">管理员</option>
                    </select>
                    <br>
                    <br>
                    <input type="button" value="提交"><br>
                    <div>
                        <a href="usersadmin.jsp">返回管理中心</a>
                    </div>
                </tr>
            </table>
        </div>
    </div>
</div>
</body>
</html>
